// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file TestEvt.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace {
char dummy;
}  // namespace
#endif  // _WIN32

#include "TestEvt.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

test_interface::msg::TestEvt::TestEvt()
{
    // m_name com.eprosima.idl.parser.typecode.StringTypeCode@fe18270
    m_name ="";
    // m_second com.eprosima.idl.parser.typecode.PrimitiveTypeCode@6fb0d3ed
    m_second = 0;
    // m_payload_size com.eprosima.idl.parser.typecode.PrimitiveTypeCode@6dde5c8c
    m_payload_size = 0;
    // m_payload com.eprosima.idl.parser.typecode.SequenceTypeCode@5123a213


}

test_interface::msg::TestEvt::~TestEvt()
{



}

test_interface::msg::TestEvt::TestEvt(
        const TestEvt& x)
{
    m_name = x.m_name;
    m_second = x.m_second;
    m_payload_size = x.m_payload_size;
    m_payload = x.m_payload;
}

test_interface::msg::TestEvt::TestEvt(
        TestEvt&& x)
{
    m_name = std::move(x.m_name);
    m_second = x.m_second;
    m_payload_size = x.m_payload_size;
    m_payload = std::move(x.m_payload);
}

test_interface::msg::TestEvt& test_interface::msg::TestEvt::operator =(
        const TestEvt& x)
{

    m_name = x.m_name;
    m_second = x.m_second;
    m_payload_size = x.m_payload_size;
    m_payload = x.m_payload;

    return *this;
}

test_interface::msg::TestEvt& test_interface::msg::TestEvt::operator =(
        TestEvt&& x)
{

    m_name = std::move(x.m_name);
    m_second = x.m_second;
    m_payload_size = x.m_payload_size;
    m_payload = std::move(x.m_payload);

    return *this;
}

bool test_interface::msg::TestEvt::operator ==(
        const TestEvt& x) const
{

    return (m_name == x.m_name && m_second == x.m_second && m_payload_size == x.m_payload_size && m_payload == x.m_payload);
}

bool test_interface::msg::TestEvt::operator !=(
        const TestEvt& x) const
{
    return !(*this == x);
}

size_t test_interface::msg::TestEvt::getMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1;

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);




    return current_alignment - initial_alignment;
}

size_t test_interface::msg::TestEvt::getCdrSerializedSize(
        const test_interface::msg::TestEvt& data,
        size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1;

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    if (data.payload().size() > 0)
    {
        current_alignment += (data.payload().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
    }




    return current_alignment - initial_alignment;
}

void test_interface::msg::TestEvt::serialize(
        eprosima::fastcdr::Cdr& scdr) const
{

    scdr << m_name;
    scdr << m_second;
    scdr << m_payload_size;
    scdr << m_payload;

}

void test_interface::msg::TestEvt::deserialize(
        eprosima::fastcdr::Cdr& dcdr)
{

    dcdr >> m_name;
    dcdr >> m_second;
    dcdr >> m_payload_size;
    dcdr >> m_payload;
}

/*!
 * @brief This function copies the value in member name
 * @param _name New value to be copied in member name
 */
void test_interface::msg::TestEvt::name(
        const std::string& _name)
{
    m_name = _name;
}

/*!
 * @brief This function moves the value in member name
 * @param _name New value to be moved in member name
 */
void test_interface::msg::TestEvt::name(
        std::string&& _name)
{
    m_name = std::move(_name);
}

/*!
 * @brief This function returns a constant reference to member name
 * @return Constant reference to member name
 */
const std::string& test_interface::msg::TestEvt::name() const
{
    return m_name;
}

/*!
 * @brief This function returns a reference to member name
 * @return Reference to member name
 */
std::string& test_interface::msg::TestEvt::name()
{
    return m_name;
}
/*!
 * @brief This function sets a value in member second
 * @param _second New value for member second
 */
void test_interface::msg::TestEvt::second(
        uint32_t _second)
{
    m_second = _second;
}

/*!
 * @brief This function returns the value of member second
 * @return Value of member second
 */
uint32_t test_interface::msg::TestEvt::second() const
{
    return m_second;
}

/*!
 * @brief This function returns a reference to member second
 * @return Reference to member second
 */
uint32_t& test_interface::msg::TestEvt::second()
{
    return m_second;
}

/*!
 * @brief This function sets a value in member payload_size
 * @param _payload_size New value for member payload_size
 */
void test_interface::msg::TestEvt::payload_size(
        uint32_t _payload_size)
{
    m_payload_size = _payload_size;
}

/*!
 * @brief This function returns the value of member payload_size
 * @return Value of member payload_size
 */
uint32_t test_interface::msg::TestEvt::payload_size() const
{
    return m_payload_size;
}

/*!
 * @brief This function returns a reference to member payload_size
 * @return Reference to member payload_size
 */
uint32_t& test_interface::msg::TestEvt::payload_size()
{
    return m_payload_size;
}

/*!
 * @brief This function copies the value in member payload
 * @param _payload New value to be copied in member payload
 */
void test_interface::msg::TestEvt::payload(
        const std::vector<uint8_t>& _payload)
{
    m_payload = _payload;
}

/*!
 * @brief This function moves the value in member payload
 * @param _payload New value to be moved in member payload
 */
void test_interface::msg::TestEvt::payload(
        std::vector<uint8_t>&& _payload)
{
    m_payload = std::move(_payload);
}

/*!
 * @brief This function returns a constant reference to member payload
 * @return Constant reference to member payload
 */
const std::vector<uint8_t>& test_interface::msg::TestEvt::payload() const
{
    return m_payload;
}

/*!
 * @brief This function returns a reference to member payload
 * @return Reference to member payload
 */
std::vector<uint8_t>& test_interface::msg::TestEvt::payload()
{
    return m_payload;
}

size_t test_interface::msg::TestEvt::getKeyMaxCdrSerializedSize(
        size_t current_alignment)
{
    size_t current_align = current_alignment;



    return current_align;
}

bool test_interface::msg::TestEvt::isKeyDefined()
{
    return false;
}

void test_interface::msg::TestEvt::serializeKey(
        eprosima::fastcdr::Cdr& scdr) const
{
    (void) scdr;
        
}


